Enterprise Objects Framework Release 1.1 Copyright ã1995 by NeXT Computer, Inc.  All Rights Reserved.

EOCustomValues
(informal protocol)

Category Of:	NSObject

Declared In:	eoaccess/EOCustomValues.h

Category Description

The Enterprise Objects Framework uses the methods of the EOCustomValues and EODatabaseCustomValues categories to package text or binary data into custom value objects. A custom value class can be specified for a database column read through the access layer, or for a user interface object accessed through the interface layer. For example, you can map a binary column in a database to an NXImage subclass, or a text entry field in your application to a Currency class.

EOCustomValues declares the methods for custom value classes based on text data; EODatabaseCustomValues declares the methods for custom value classes based on binary data. Your custom value class can implement either or both of these categories' methods, depending on how its values will be accessed by the various components of the Framework and your application.

Implementing EOCustomValues

Your custom value objects are initialized with initWithString:type:, which offers the text data and a string identifying the format of that data; for example, ªRTFº. The value object can use this type string to determine how to interpret the text data. When your object's data is needed in its raw form, it's sent a stringForType: message specifying the type needed. Your object must produce an NSString object containing text in the named format.

In addition to implementing the methods declared in this category, your custom value class must meaningfully implement the description method if its value is to be displayed in a text control. description is the standard method for getting a reasonable text representation of an object, described in the NSObject class specification of the Foundation Kit Reference. Your custom class must also implement this method if it's to be used for an enterprise object's primary key.

Method Types

Initializing instances	- initWithString:type:

Getting data as a type	- stringForType:

Instance Methods

initWithString:type:

- initWithString:(NSString *)aString type:(NSString *)typeString

Initializes the receiver to contain the value in aString. typeString, if non-nil, indicates the format of the contents of aString; for example, ªRTFº. Returns self.

See also:  - valueType (EOAttribute class)

stringForType:

- (NSString *)stringForType:(NSString *)typeString

Returns the value of the receiver as a string object in the format indicated by typeString. For example, this code excerpt produces a string in Rich Text Format:

NSString *rtfString = [myCustomValue stringForType:@"RTF"];

See also:  - valueType (EOAttribute class)